﻿using UnityEngine;
using System.Collections;

public class Death : MonoBehaviour 
{
    public GameObject deathParticleFxPrefab = null;
    public Vector3 deathParticleFxOffset;

	void Update() 
    {
        if (Input.GetMouseButtonDown(0))
            PlayerDeath();
	}

    void PlayerDeath()
    {
        GameObject deathParticleFx = (GameObject)Instantiate(deathParticleFxPrefab);
        Vector3 position = transform.position;
        Vector3 particlePosition = new Vector3(position.x + deathParticleFxOffset.x,position.y + deathParticleFxOffset.y, 
            position.z + deathParticleFxOffset.z);
        deathParticleFx.transform.position = particlePosition;
        Destroy(gameObject, 1.8f);
    }
}
